package com.qianyu.project.web.controller.ww;

import com.baomidou.mybatisplus.extension.api.R;
import com.qianyu.project.entity.BuildProgressPlan;
import com.qianyu.project.service.IBuildProgressPlanService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author ww
 * @desc
 */
@RestController
@RequestMapping("/buildprogressplan")
public class BuildProgressPlanController {
    @Autowired
    IBuildProgressPlanService iBuildProgressPlan;

    @PostMapping
    public Result save(@RequestBody Map<String,String> map ){
        BuildProgressPlan buildProgressPlan = new BuildProgressPlan();
        buildProgressPlan.setId(null);
        buildProgressPlan.setPId(Integer.parseInt(map.get("p_id")));
        buildProgressPlan.setMainTask(map.get("main_task"));
        buildProgressPlan.setSubTask(map.get("sub_task"));
        buildProgressPlan.setStartDate(map.get("start_date"));
        buildProgressPlan.setEndDate(map.get("end_date"));
        return ResultTool.success(iBuildProgressPlan.saveOrUpdate(buildProgressPlan));
    }

    @GetMapping
    public Result Tlist(@RequestParam Map<String,String> params ){
        return ResultTool.success(iBuildProgressPlan.Tlist(params));
    }
}
